# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=xpm-nox

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.2.0
pkgrel=1
pkgdesc="X Pixmap library not using X (mingw-w64)"
arch=('any')
url="ftp://koala.inria.fr/pub/xpm"
license=("Groupe Bull")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
options=('strip' 'staticlibs' '!buildflags' '!makeflags')
source=(ftp://koala.inria.fr/pub/xpm/xpm-nox-${pkgver}.tar.bz2
    xpm-nox-4.2.0-mingw.patch)
md5sums=('c87a25f7cfae59cd536b708d02c0cfad'
         '1e4a8f2d8d02935edfd5986310a61aa0')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/xpm-nox-4.2.0-mingw.patch
}

build() {
  cp -r "${srcdir}"/${_realname}-${pkgver} "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  
  make prefix=${MINGW_PREFIX} CC=${MINGW_CHOST}-gcc
}

package() {
    cd "${srcdir}/build-${MINGW_CHOST}"
    make CC=${MINGW_CHOST}-gcc prefix=${MINGW_PREFIX} DESTDIR="${pkgdir}" install
}
